<admintpl file="header" />
<link href="/public/simpleboot/themes/live/live_panel.css" rel="stylesheet">
<!--编辑器基本配置-->
	<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.config.js"></script>
<!--编辑器完整代码-->
	<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.all.min.js"></script>
	<script src="/public/js/jquery.js"></script>

	<script src="/public/simpleboot/themes/live/live_panel.js?ver=1.0"></script>
	
	<script src="http://cdn.ronghub.com/RongIMLib-2.2.4.min.js"></script>
    <script src="http://cdn.ronghub.com/RongEmoji-2.2.4.min.js"></script>
	<!--  
		<script src="__PUBLIC__/js/common.js"></script>
		<script src="__PUBLIC__/js/layer/layer.js"></script>	
	-->
	<script src="/public/simpleboot/themes/live/live_panel_chatroom.js?ver=1.0"></script>	
	<script src="/public/simpleboot/themes/live/jquery.sha1.js"></script>
	<script src="__PUBLIC__/js/layer/layer.js"></script>
	<script src="__PUBLIC__/js/upload_file/jquery-1.10.2.min.js"></script>
    <script src="__PUBLIC__/js/upload_file/jquery.ui.widget.min.js"></script>
    <script src="__PUBLIC__/js/upload_file/jquery.fileupload.js"></script>
	<script>
	document.domain = "<?php echo C('domain');?>";
	function chose_video(){
		var chosed_video_ids = $("#chosed_video_ids").val();
		  layer.open({
		    type: 2,
		    //skin: 'layui-layer-lan',
		    title: '上传视频',
		    fix: false,
		    shadeClose: true,
		    maxmin: true,
		    area: ['1000px', '500px'],
		    content: "<?php echo U('Admin/LivePanel/chose_video',array('live_id'=>$live_id))?>"+"&chosed_video_ids="+chosed_video_ids,
		    end: function(){
		    }
		  });
	}
	
	function setVideo(video_name, video_url, video_id){
		var chosed_video_ids = $("#chosed_video_ids").val();
		var chosed_video_names = $("#chosed_video_names").val();
		var chosed_video_urls = $("#chosed_video_urls").val();
		old_chosed_video_ids_arr = chosed_video_ids.split(',');  //原始数组
		old_chosed_video_names_arr = chosed_video_names.split(',');  //原始数组
		old_chosed_video_urls_arr = chosed_video_urls.split('~');  //原始数组
		if(old_chosed_video_ids_arr.indexOf(video_id) != '-1'){
			$.each(old_chosed_video_ids_arr,function(index,item){  
	            // index是索引值（即下标）   item是每次遍历得到的值；
	            if(item==video_id){
	            	old_chosed_video_ids_arr.splice(index,1);
	            	old_chosed_video_names_arr.splice(index,1);
	            	old_chosed_video_urls_arr.splice(index,1);
	            	
	        	}
	     	});
			chosed_video_ids = old_chosed_video_ids_arr.join(",");
			chosed_video_names = old_chosed_video_names_arr.join(",");
			chosed_video_urls = old_chosed_video_urls_arr.join("~");
		}else{
			chosed_video_ids+=video_id+',';
			chosed_video_names+=video_name+',';
			chosed_video_urls+=video_url+'~';
		}
		
		chosed_video_ids_arr = chosed_video_ids.split(',');
		chosed_video_ids_arr.pop();
		chosed_video_names_arr = chosed_video_names.split(',');
		chosed_video_names_arr.pop();
		chosed_video_urls_arr = chosed_video_urls.split('~');
		chosed_video_urls_arr.pop();
		var show_html = '';
		for (var i=1;i<=chosed_video_ids_arr.length;i++)
		{
			show_html +="<span>"+i+".视频名称:"+chosed_video_names_arr[parseInt(i) - 1]+"</span></br>";
		}
		$("#chose_video_show").html(show_html);
		$("#chosed_video_ids").val(chosed_video_ids);
		$("#chosed_video_names").val(chosed_video_names);
		$("#chosed_video_urls").val(chosed_video_urls);
	}
	$(function () {
	    $("input[type=file]").fileupload({
	        dataType: "json",
	        limitMultiFileUploadSize: 52428800,
	        change: function (e, data) {
	            console.log(data);
	        },
	        done: function (e, data) {
	        	var img_url = data['result'];
	        	var upload_img_urls = $("#upload_img_urls").val();
	        	upload_img_urls+=img_url+'~';

	    		upload_img_urls_arr = upload_img_urls.split('~');
	    		upload_img_urls_arr.pop();
	    		var show_img_html = '';
	    		for (var i=0;i<upload_img_urls_arr.length;i++)
	    		{
	    			show_img_html +='<li><img src="'+upload_img_urls_arr[i]+'" alt="" /><span><a href="javascript:;" class="del_btn">删除</a></span></li>';
	    		}
	    		$("#upload_img_show").html(show_img_html);
	        	$("#upload_img_urls").val(upload_img_urls);
	            console.log(data);
	        }
	    })
	    $("body").on("click", ".del_btn", function () {
	    	var img_url = $(this).parent().siblings("img").attr("src");
	    	del_img(img_url);
	    })
	})
	
	function del_img(img_url){
		var upload_img_urls = $("#upload_img_urls").val();
    	old_upload_img_urls_arr = upload_img_urls.split('~');  //原始数组
		if(old_upload_img_urls_arr.indexOf(img_url) != '-1'){
			$.each(old_upload_img_urls_arr,function(index,item){  
	            // index是索引值（即下标）   item是每次遍历得到的值；
	            if(item==img_url){
	            	old_upload_img_urls_arr.splice(index,1);
	        	}
	     	});
			upload_img_urls = old_upload_img_urls_arr.join("~");
		}
    	
		upload_img_urls_arr = upload_img_urls.split('~');
		upload_img_urls_arr.pop();
		var show_img_html = '';
		for (var i=0;i<upload_img_urls_arr.length;i++)
		{
			show_img_html +='<li><img src="'+upload_img_urls_arr[i]+'" alt="" /><span><a href="javascript:;" class="del_btn">删除</a></span></li>';
		}
		$("#upload_img_show").html(show_img_html);
    	$("#upload_img_urls").val(upload_img_urls);
    	
	}
	
	
	//接受iframe传过来的上榜用户信息
	function getOnlistInfo(user_id, username, content){
		console.log(user_id)
		console.log(username)
		console.log(content)
		$("#opt_type").val('3');
		$("#onlist_user_id").val(user_id);
		$("#onlist_nickname").val(username);
		$("#user_speak_content_show").html(content);
		
	}
	</script>
</head>

<body>

	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('Admin/Live/index')}">直播列表</a></li>
			<li><a href="{:U('Admin/Live/add')}">添加直播</a></li>
			<li class="active"><a href="{:U('Admin/Live/news_relation', array('live_id'=>$live_id))}">直播员管理面板</a></li>
		</ul> 
	</div>
	
	<div id="outside">
		<div id="live_top">
		  <ul>
		  	<li>ID: {$live_id}</li>
		  	<li>直播标题: {$data['name']}</li>
		  	<li>开始时间: {$data['start_time']}</li>
		  </ul>
		</div>
	 	<div id="live_main">
	 		<div id="live_list">
	 			<div id="live_list_end_temp" style="height:0px; overflow:hidden;display:none"></div>	 			
	 		</div>	 		
	 		<div id="send_box">
	 			<div id="chat_box">
	 					<input type="hidden" id="live_id" value="{$live_id}"  />
	 					<!-- opt_type:1(浏览状态，新增状态,要上传非上榜的图文）；2（编辑状态:含正常数据的编辑，及上榜回复信息的编辑）；3：（上榜状态:要添加新的上榜图文） -->
	 					<input type="hidden" id="opt_type" value="1" />
	 					<input type="hidden" id="msg_id" value="0" />
	 					<input type="hidden" id="onlist_user_id" value="" />
	 					<input type="hidden" id="onlist_nickname" value="" />
	 					<input type="hidden" id="user_speak_time" value="0" />
	 					
						<!--  <script type="text/plain" id="pic_txt_content" name="newsContent"  style="width:702px;height:230px;" ></script>-->
						                <span id="emoji_span" style="cursor:pointer;"></span>
						                <span id="emoji_span" style="cursor:pointer;">123</span>
						                <span id="emoji_span" style="cursor:pointer;">123</span>
                						<div class="r_box" id="all_emoji_div" style="margin-top:-32px;z-index:999;background:#2c3e50;margin-right:40px;height:200px;overflow-y:scroll;visibility:hidden;"></div>
						<textarea style="width:702px;height:230px;" id="content"></textarea>
						<div class="span7" id="user_speak_content_show"></div>

						
			            <div class="span7">
			                <a class="btn btn-primary">上传图片</a>
			                <a class="btn btn-primary"  onclick="getOnlistInfo('2016147485356358','张三','这里是内容')">上榜</a>
			                <input type="hidden" id="upload_img_urls" value="">
			                <input type="file" value="submit" class="btn-file" data-url="{:U('Admin/LivePanel/upload_img')}" name="imageFile"/>
			                 <a class="btn btn-primary"  onclick="chose_video()">选择视频</a>
			                 <input type="hidden" id="chosed_video_ids" value="">
			                 <input type="hidden" id="chosed_video_names" value="">
			                 <input type="hidden" id="chosed_video_urls" value="">
			                 <style>
			                 	.span7 {
			                 		position: relative;
			                 	}
			                 	.btn-file {
			                 		position: absolute;
			                 		top: 0;
			                 		left: 0;
			                 		width: 56px!important;
			                 		height: 20px!important;
			                 		z-index: 3;
			                 		opacity: 0;
			                 	}
			                 </style>
			            </div>
			            <div style="height:50px;"></div>
			            <div class="span7" id="chose_video_show"></div>
			            

					<!-- 防止在编辑器中按ctrl+回车自动提交 
					<form id="live_form" method="post" action="./index.php?g=Admin&m=Live&a=live_update&live_id={$live_id}"  onkeydown="if(event.keyCode==13){alert('button');return false;}" onSubmit="alert('form');return false;">
					</form>
					 -->
	 			</div>	 	 			
	 			<div id="prompt_msg">	 			    
	 			    <div id="btn_box">
	 					<div id="send_button" class="msg_btn" title="上传数据到服务器">发送</div>
	 					<div id="cancel_button" class="msg_btn" title="取消编辑或上榜">取消</div>
	 				</div>
	 				<div id="user_speak_content_box"> 
	 					<div id="to_top_prompt_info">
	 						<ul class="clearfix">
	 							<div id="upload_img_show"></div>
	 						</ul>
	 					</div>
	 				</div>
	 			</div>						
	 		</div>
	 	</div>	
	 	<style>
	 		.clearfix:after {
	 			height: 0;
	 			content: "\200B";
	 			clear: both;
	 			display: block;
	 		}
	 		.clearfix {
	 			*zoom: 1;
	 		}
		 	ul, li {
		 		list-style: none;
		 	}
		 	#to_top_prompt_info li  {
	 			float: left;
	 			margin-right: 10px;
	 			margin-bottom: 10px;
	 		}
	 		#to_top_prompt_info img {
	 			display: block;
	 			width: 100px;
	 			height: 60px;
	 		}
	 		#to_top_prompt_info span {
	 			width: 100%;
	 			display: block;
	 			text-align: center;
	 			padding: 4px 0;
	 		}
	 	</style>
	 	<div id="chat_room">
	 	
	 	    <input type="hidden" value="{$admin_id}" id="admin_id"/>
	 	    <input type="hidden" value="{$rcloud_token}" id="rcloud_token"/>
	 	    <input type="hidden" value="{$ryAppKey}" id="ryAppKey"/>
	 	    <input type="hidden" value="{$chatRoomId}" id="chatRoomId"/><!-- 
	 	    <iframe src="http://www.51vip.biz:3445/iframe/live?live_id=201614763435875412&token=4459d7e53e0d68d138295ec0259d3af9093ea193&type=chatroom" frameborder="0" style="height:100%"></iframe>
	 	    
		 	<div class="r_box">
	            <div class="title">
	                                                  直播备忘
	            </div>
	            <div class="bw_con">
	                <p>{$remark}</p>
	            </div>
	        </div>
	        <div class="r_box">
	            <div class="title">
	                                                       互动聊天
	            </div>
	            <div class="bw_con">
	           	    <div class="btn_box1">
	                	<div class="input_box">
	                		<input type="text" placeholder="系统消息" id="sys_msg_input" class="input1" /><input type="submit" id="send_sys_msg_btn" value="提交" class="btn1" />
	                    </div>
	                </div>
	                <div class="liuyan_list">
	                    <div class="xtxx">系统消息：<span id="sys_msg_span" style="width:100px;text-overflow:ellipsis;word-break:keep-all;white-space:nowrap; overflow:hidden; "></span></div>
	                    <ul id="receive_msg_ul" style="min-height:90px;">
	                        
	                    </ul>
	                </div>
	                
	              	<div class="btn_box2">
	                	<div class="input_box">
	                		<input type="text" placeholder="实时评论互动" id="chat_msg_input" class="input1" style="width:170px;"/>
	                		<span id="emoji_span" style="cursor:pointer;"></span>
	                		<input type="submit" id="send_chat_msg_btn" value="提交" class="btn1" />
	                		给<input type="text" value="zrl_id" id="touser" />发消息
	                		<input type="button" id="tosendmessage" value="发送" />
	                    </div>
	                </div>
	            </div>
       		 </div> -->
       		 <div class="r_box" id="all_emoji_div" style="margin-top:-32px;z-index:999;background:#2c3e50;margin-right:40px;height:200px;overflow-y:scroll;visibility:hidden;"></div>
	 	</div>
	 	<div id="icon_explain">
	 		<div class="icon_elem2"><img src="/public/simpleboot/themes/live/img/li-bold.png" /><span class="icon_explain_text">加粗</span></div>
	 		<div class="icon_elem"><img src="/public/simpleboot/themes/live/img/li-color.png" /><span class="icon_explain_text">字体颜色</span></div>
	 		<div class="icon_elem"><img src="/public/simpleboot/themes/live/img/li-emoji.png" /><span class="icon_explain_text">添加表情 </span></div>
	 		<div class="icon_elem"><img src="/public/simpleboot/themes/live/img/li-image.png" /><span class="icon_explain_text">添加图片</span></div>
	 		<div class="icon_elem"><img src="/public/simpleboot/themes/live/img/li-video.png" /><span class="icon_explain_text">添加视频</span></div>
	 		<div class="icon_elem"><img src="/public/simpleboot/themes/live/img/li-album.png" /><span class="icon_explain_text">添加图集</span></div>
	 		<div class="icon_elem"><img src="/public/simpleboot/themes/live/img/li-link.png" /><span class="icon_explain_text">添加链接 </span></div>
	 		<div class="icon_elem_split"></div>	 		
	 		<div class="icon_elem2"><img src="/public/simpleboot/themes/live/img/li-refresh.png" /><span class="icon_explain_text">刷新</span></div>
	 		<div class="icon_elem2"><img src="/public/simpleboot/themes/live/img/li-edit.png" /><span class="icon_explain_text">编辑 </span></div>
	 		<div class="icon_elem2"><img src="/public/simpleboot/themes/live/img/li-to-top.png" /><span class="icon_explain_text">置顶 </span></div>
	 		<div class="icon_elem2"><img src="/public/simpleboot/themes/live/img/li-to-del.png" /><span class="icon_explain_text">删除 </span></div>
	 		<div class="icon_elem_split"></div>
	 		<div class="icon_elem2"><img src="/public/simpleboot/themes/live/img/li-to-list.png" /><span class="icon_explain_text">上榜 </span></div>
	 		<div class="icon_elem2"><img src="/public/simpleboot/themes/live/img/li-to-black.png" /><span class="icon_explain_text">拉黑 </span></div>	  
		</div>
 	</div>
</body>
</html>